/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Separate_Chat;

/**
 *
 * @author lubinchen
 */


import java.util.*;
import java.io.*;

public class Fake_Serverv3 {


    private static ArrayList<Hashtable> AL_HT1 = new ArrayList<Hashtable>(0);
    private static ArrayList<Hashtable> AL_HT2 = new ArrayList<Hashtable>(0);
    private static ArrayList<Hashtable> AL_HT3 = new ArrayList<Hashtable>(0);
    IpChat_Main chat=null;

    private Fake_Serverv3(){



    // construct a Hashtable

            /*Creates Hashtable test and user attributes*/

         /*****************************************************/
            Hashtable test = new Hashtable();
            /*Insert user attributes into Hashtable test*/
            test.put("username", "Lubin");
            test.put("ip", "192.168.1.104");
            test.put("lvl", new Integer(5));
            test.put("team", new Integer(1));
            /*Insert test into AL_HT*/
            AL_HT1.add(test);



            Hashtable test2 = new Hashtable();

            test2.put("username", "yuanYe");
            test2.put("ip", "192.168.1.103");
            test2.put("lvl", new Integer(2));
            test2.put("team", new Integer(2));

            AL_HT1.add(test2);




            /*****************************************************/
            Hashtable test3 = new Hashtable();
            /*Insert user attributes into Hashtable test*/
            test3.put("username", "Lubin");
            test3.put("ip", "192.168.1.104");
            test3.put("lvl", new Integer(5));
            test3.put("team", new Integer(1));
            /*Insert test into AL_HT*/
            AL_HT2.add(test3);



            Hashtable test4 = new Hashtable();

            test4.put("username", "yuanYe");
            test4.put("ip", "192.168.1.103");
            test4.put("lvl", new Integer(2));
            test4.put("team", new Integer(2));

            AL_HT2.add(test4);





            /*****************************************************/
            Hashtable test5 = new Hashtable();
            /*Insert user attributes into Hashtable test*/
            test5.put("username", "Lubin");
            test5.put("ip", "192.168.1.104");
            test5.put("lvl", new Integer(5));
            test5.put("team", new Integer(1));
            /*Insert test into AL_HT*/
            AL_HT3.add(test3);



            Hashtable test6 = new Hashtable();

            test6.put("username", "yuanYe");
            test6.put("ip", "192.168.1.103");
            test6.put("lvl", new Integer(2));
            test6.put("team", new Integer(2));

            AL_HT3.add(test4);

            select_String();
            chat= new IpChat_Main();

    }



    private void select_String(){

        String s = ""; // Line read from standard in
        int n=0;

          while (!(s.equals("quit"))){

              System.out.println("Enter a the new hash array to update (type 'quit' to exit): ");
		try {
			InputStreamReader converter = new InputStreamReader(System.in);
			BufferedReader in = new BufferedReader(converter);
			s = in.readLine();
                        n = Integer.parseInt(s);
		} catch (Exception e) {
			System.out.println("Error! Exception: "+e);
		}


              switch(n)
              {

                  case 1: chat.update_HashTableArray(AL_HT1);   break;
                  case 2: chat.update_HashTableArray(AL_HT2);   break;
                  case 3: chat.update_HashTableArray(AL_HT3);   break;
             }
         }
        
    }


    public static void main(String[] args)
    {
           Fake_Serverv3 fs=new Fake_Serverv3();
           System.out.println("Please select an String to update to ");






    }

           

}
